package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	f, err := os.Open("./demo.txt")
	if err != nil {
		fmt.Println(err.Error())
	}
	defer f.Close()

	reader := bufio.NewReader(f)
	for {
		line, isPrefix, err := reader.ReadLine()
		if err == io.EOF {
			fmt.Println("文件读完了")
			break
		}
		if err != nil {
			fmt.Printf("文件读取失败%s\n", err.Error())
			return
		}
		fmt.Println(string(line), isPrefix)
	}
}
